package net.web.inst.struts2;

import java.util.HashMap;
import java.util.Map;

import net.esj.basic.core.engine.config.MelonConfig;
import net.esj.basic.view.BaseAction;
import net.melon.sso.pojo.Member;
import net.web.WebConstants;


public class WebAction extends BaseAction implements WebConstants{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	protected String id;
	
	private String resultUrl;
	
	protected Map<String,Object> map = new HashMap<String, Object>(); 
	
	protected static Map<String,String> codeSession = new HashMap<String,String>(); 
	
	public void setCitySession(Long regionId){
		getSession().setAttribute("regionId", regionId);
	}
	
	public Long getCitySession(){
		Long regionId = (Long)getSession().getAttribute("regionId");
		if(regionId==null){
			return 10L;
		}else{
			return regionId;
		}
	}
	
	
	public boolean getIsLogin(){
		Member member = getSessionMember();
		if(member==null){
			return false;
		}else{
			return true;
		}
	}
	
	public String getMobile(){
		Member member = getSessionMember();
		if(member!=null){
			return member.getMobile();
		}else{
			return "";
		}
	}
	
	public String getPayUrl(){
		return MelonConfig.getProperty("sso.server.domain") + "/AlipayServlet";
	}
	

	public Member getSessionMember(){
		Member member = getSessionUser(Member.class);
		return member;
	}
	
	public String getResultUrl() {
		return resultUrl;
	}

	public void setResultUrl(String resultUrl){
		this.resultUrl = MelonConfig.getProperty("webresult.templates") + "pc/" + resultUrl + ".ftl";
	}

	public String getImageUrl(){
		return MelonConfig.getProperty("melon.sys.download.url");
	}
	
	public String getWebUrl(){
		return MelonConfig.getProperty("web.url");
	}
	
	public String getStaticDomain(){
		return MelonConfig.getProperty("static.domain");
	}
	
	public String getStaticVersion(){
		return MelonConfig.getProperty("static.version");
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	
	
}
